<template>
    <div class="w-full h-full flex flex-col">
        <div class="w-full flex flex-row items-center    justify-between">
            <div class="cursor-pointer w-w1/5" @click="action_page_back">
                <i class="el-icon-d-arrow-left  text-c3 text-f20 hover:text-cmain">
                  <span class=" ml-w10 hover:text-cmain">{{name }}--回收站</span></i>
            </div>
        </div>
        <div class="w-full h-full mt-w20 ">
            <el-table :data="staffBinList" stripe style="width: 100%; " height="700px">
                <el-table-column type="index" label="序号" min-width="10%">
                </el-table-column>
                <el-table-column prop="name" label="员工姓名" min-width="10%">
                </el-table-column>
                <el-table-column prop="department" label="所属部门" min-width="10%">
                </el-table-column>
                <el-table-column prop="phone" label="员工电话" min-width="10%">
                </el-table-column>
                <el-table-column prop="job" label="员工工号" min-width="10%">
                </el-table-column>
            </el-table>
            <div class="w-full flex items-end justify-center" style="height:7%">
                <el-pagination background layout="prev, pager, next" :total="total"
                    :page-size="limit" @current-change="action_page_change">
                </el-pagination>
            </div>
        </div>
    </div>
</template>

<script lang="ts">

import {Component, Vue} from "vue-property-decorator";
import nyNetwork from "@/api/nyBaseNetwork";
import DZModelStaff from "@/views/员工管理/model/DZModelStaff";

@Component
export default class Bin extends Vue {

    page = 1;

    limit = 10;

    total = 0;

    id = '';

    name = '';

    staffBinList = [];

    mounted() {
      this.id = this.$route.query.id as string;
      this.name = this.$route.query.name as string;
      this.action_list_bin();
    }

    action_list_bin(){
        let list_data = [];
        let param = { page:this.page, limit:this.limit, company: this.id}
        nyNetwork.net("员工回收站列表", param, data => {
          this.total = data.total;
          let dataList = data.list;
          for (const item of dataList) {
            let staff = new DZModelStaff();
            staff.id = item.iId ?? "";
            staff.department = item.sDepartmentName ?? "";
            staff.phone = item.sPhone ?? "";
            staff.job = item.sJobNum ?? "";
            staff.name = item.sName ?? "";
            list_data.push(staff);
          }
          this.staffBinList = list_data;
        })

    }

    action_page_change(cur_page) {
      this.page = cur_page;
      this.action_list_bin();
    }

    action_page_back() {
      this.$router.go(-1);
      //this.$router.push({ path: (this.$route.query.father as string) })
    }
}



</script>
